/**
 * Copyright (C), 2016-2019
 * FileName: UserServiceImpl
 * Author:   yacnog_liu
 * Date:     2019/4/5 16:42
 * Description:
 */
package com.mayi.bootdemo.service.impl;

import com.mayi.bootdemo.mapper.UserMapper;
import com.mayi.bootdemo.pojo.User;
import com.mayi.bootdemo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper mapper;

    @Override
    public void insertUser(User user) {
        Date date = new Date();
        user.setCreateTime(date);
        user.setUpdateTime(date);
        this.mapper.insertUser(user);
    }

    @Override
    public List<User> findAllUser() {
        return this.mapper.findAllUser();
    }
}
